<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>添加或编辑界面</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
    <style>
        .w440 {
            width: 440px !important;
        }
    </style>
</head>
<body>
<div class="page-content-wrap clearfix">
    <form class="layui-form" id="tool">
        <input type="hidden" name="applyId" value="${applyId}" />
        <div class="layui-tab">
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;工号：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="jobNum" value="${rewardStaff.jobNum}" lay-verify="required" placeholder="请输入工号" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;真实姓名：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="name" value="${rewardStaff.name}" lay-verify="required" placeholder="请输入真实姓名" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;手机号码：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="mobile" value="${rewardStaff.mobile}" lay-verify="required|phone" placeholder="请输入手机号码" autocomplete="off"
                                   class="layui-input" maxlength="11">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;评价星级：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="stars" value="<#if rewardStaff.stars==''>5.0<#else>${rewardStaff.stars?string['0.0']}</#if>" lay-verify="required|stars"
                                   placeholder="请输入评价星级" autocomplete="off" class="layui-input" maxlength="11">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;所有赏金：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="totalMoney" value="<#if rewardStaff.totalMoney==''>0<#else>${rewardStaff.totalMoney?string['0.00']}</#if>"
                                   lay-verify="required|money" placeholder="请输入所有赏金" autocomplete="off" class="layui-input" maxlength="11" readonly>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;剩余赏金：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="haveMoney" value="<#if rewardStaff.haveMoney==''>0<#else>${rewardStaff.haveMoney?string['0.00']}</#if>"
                                   lay-verify="required|money" placeholder="请输入剩余赏金" autocomplete="off" class="layui-input" maxlength="11" readonly>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;收款账号：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="account" value="${rewardStaff.account}" lay-verify="required" placeholder="请输入收款账号" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;员工类型：</label>
                        <div class="layui-input-inline w440">
                            <select name="staffType" id="staffType" lay-verify="required"></select>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="margin-left: 0px !important;text-align: center">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="submitBtn">提交</button>
                <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                <button type="button" style="display: none;" id="save" class="layui-btn layui-btn-primary"></button>
            </div>
        </div>
    </form>
</div>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'form', 'page', 'baseutil'], function () {
        var $ = layui.jquery,
            form = layui.form,
            page = layui.page,
            baseutil = layui.baseutil;

        page.initDict('staff_type', function (dictData) {
            page.showDict($("#staffType"), page.aceeptDictContentList(dictData, 'staff_type'), "请选择", '${rewardStaff.staffType}');
        });

        form.verify({
            stars: function (e) {
                if (!e || isNaN(e) || parseFloat(e) < 0.0 || parseFloat(e) > 5.0 || e * 10 / 5 < 1 || e * 10 / 5 > 10 || e * 10 % 5 !== 0) return "评价星级格式不正确"
            },
            money: function (e) {
                if (!e || isNaN(e) || parseFloat(e) < 0 || (e.split(".").length === 2 && e.split(".")[1].length > 2)) return "打赏金额格式不正确"
            }
        });

        //监听提交
        form.on('submit(submitBtn)', function (data) {
            data.field.id = '${rewardStaff.id}';
            baseutil.AjaxPostMark("/reward/rewardstaff/addOrUpdate", data.field, function () {
                $("#save").click();
            });
            return false;
        });
    });
</script>
</body>
</html>